package com.aaa.affair.service.impl;

import com.aaa.affair.service.BookShopService;
import com.aaa.affair.service.BulkBuying;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/14  17:58
 */
@Service
public class BulkBuyingImpl implements BulkBuying {
    @Autowired
    private BookShopService bookShopService;

    @Override
    @Transactional
    public void buy(List<String> isbns, String username) {
        for (String isbn : isbns){
            bookShopService.purchase(isbn,username);
        }
    }
}
